package com.atguigu.springcloud.service.impl;

import com.atguigu.springcloud.dao.AccountDao;
import com.atguigu.springcloud.service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;

/**
 * @NAME: AccountServiceImpl
 * @USER: Administrator
 * @DESCRIPTION:
 **/
@Service
@Slf4j
public class AccountServiceImpl implements AccountService {

    @Resource
    private AccountDao accountDao;

    @Override
    public void delcreate(Long userId, BigDecimal money) {
        log.info("正在扣减余额。。。。。。");
        //休息一会。。
        try {
            TimeUnit.SECONDS.sleep(20);} catch (InterruptedException e) {e.printStackTrace();}
        accountDao.delcreate(userId,money);
        log.info("扣减余额成功。。。。。。");

    }
}
